/**
 * 
 */
package parternTest;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author think
 *
 */
public class Patterner {
	
	static void print_r(String inputStr,String regex){
		System.out.println(inputStr.matches(regex));
	}
	
	static void print_r2(String inputStr,String regex){
		 Pattern p = Pattern.compile(regex);
	     Matcher m = p.matcher(inputStr);
	     while(m.find()){
	    	 System.out.println("group:"+m.group());
	     }
	     /*if(m.matches()){
	    	 System.out.print("ok");
	    	 int groupCount = m.groupCount();
	    	 for(int i=0;i<groupCount;i++){
	    		 System.out.println(m.group(i));
	    	 }
	     }*/
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		/*String regex = "/index";
		String inputStr ="/index";
		boolean match = s1.matches(regex);
		System.out.println(match);
		s1 = "/index/3}";
		match = s1.matches("/index/{\\d}");
		System.out.println(match);*/
		///index/3876/匹配 /index/{itemId}/
		
		print_r("/index","/index");
		print_r("/index/3876/","/index/*.+/");
		print_r2("/index/3876/","/index/*.+/");

	}

}
